<!--招聘管理-查询所有岗位的列表-->
<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/index' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>招聘管理-岗位列表</el-breadcrumb-item>
<!--      <el-breadcrumb-item :to="{ path: '/operation/distribution'}">招聘管理</el-breadcrumb-item>-->
<!--      <el-breadcrumb-item>岗位列表</el-breadcrumb-item>-->
    </el-breadcrumb>
    <div class="option-box">
      <span>岗位名称：<el-input size="small" style="width: 12%;" placeholder="请输入" /></span>
      <span>所属企业：<el-input size="small" style="width: 12%;" placeholder="请输入" /></span>
      <span>工作地区：<el-select v-model="type.value" size="small" placeholder="请选择" style="width: 12%">
          <el-option v-for="item in type" :key="item.value" :label="item.label" :value="item.value" />
        </el-select></span>
      <span>薪资范围：<el-select v-model="busState.value" size="small" placeholder="请选择" style="width: 12%">
          <el-option v-for="item in busState" :key="item.value" :label="item.label" :value="item.value" />
        </el-select></span>
      <br>
      <br>
      <span>状态：<el-select v-model="checkState.value" size="small" placeholder="请选择" style="width: 12%">
          <el-option v-for="item in checkState" :key="item.value" :label="item.label" :value="item.value" />
        </el-select></span>

      <el-button type="primary" size="small" @click="">搜索</el-button>
      <el-button size="small" @click="">重置</el-button>
    </div>
    <hr>
    <el-table size="small" :data="tableDate" border style="width: 100%">
      <el-table-column label="序号" type="index" align="center"></el-table-column>
      <el-table-column prop="gwi_name" label="岗位名称" width="200px" />
      <el-table-column prop="gwi_type" label="岗位类型" width="100px" />
      <el-table-column prop="" label="所属企业" width="200px" />
      <el-table-column prop="gwi_offer" label="薪资范围" width="120px" />
      <el-table-column prop="gwi_exptype" label="经验要求" width="150px" />
      <el-table-column prop="gwi_workaddr" label="工作地区" width="150px" />
      <el-table-column prop="gwi_publishstate" label="发布状态" width="100px">
        <template v-slot="scope">
          {{ scope.row.gwi_publishstate === 0 ? '草稿' : scope.row.gwi_publishstate === 1 ? '发布' : scope.row.gwi_publishstate }}
        </template>
      </el-table-column>
      <el-table-column prop="gwi_shenhestate" label="审核状态" width="100px">
        <template v-slot="scope">
          {{ scope.row.gwi_shenhestate === 1 ? '不通过' :scope.row.gwi_shenhestate === 0 ? '待审核' : scope.row.gwi_shenhestate === 2 ? '审核通过' : scope.row.gwi_shenhestate }}
        </template>
      </el-table-column>
      <el-table-column prop="user_code" label="操作" width="220px">
        <template v-slot="scope">
          <el-button size="mini" type="danger" @click="jobSelect(scope.$index, scope.row)">查看</el-button>
          <el-button v-if="scope.row.gwi_publishstate === 1" size="mini" @click="unpublish(scope.$index, scope.row)">下架</el-button>
          <el-button size="mini" @click="qyDelete(scope.$index, scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!--    <el-pagination v-model:current-page="currentPage4" v-model:page-size="pageSize4" :page-sizes="[10, 20, 30, 40]"-->
    <!--      :size="size" layout="total, sizes, prev, pager, next, jumper" :total="400" @size-change="handleSizeChange"-->
    <!--      @current-change="handleCurrentChange" />-->
  </div>
</template>

<script>
import { defineComponent, ref } from 'vue'
import {querygwlist, updategwdown} from '../../api/InstitutionApi'

export default defineComponent({
  name: "Management",
  data() {
    return {
      type: [
        {
          value: '养老院',
          label: '养老院'
        }, {
          value: '教育机构',
          label: '教育机构'
        },
      ],
      busState: [
        {
          value: '营业中',
          label: '营业中'
        }, {
          value: '已注销',
          label: '已注销'
        },
      ],
      checkState: [
        {
          value: '待审核',
          label: '待审核',
          style: 'color:"yellow"'
        },
        {
          value: '未通过',
          label: '未通过',
          style: 'color:"red"'
        },
        {
          value: '已入驻',
          label: '已入驻'
        },
      ],
      source: [
        {
          value: '自行申请-小程序',
          label: '自行申请-小程序'
        },
        {
          value: '推广员申请-小程序',
          label: '推广员申请-小程序'
        }
      ],
      authentication: [
        {
          value: '已认证',
          label: '已认证'
        },
        {
          value: '未认证',
          label: '未认证'
        }
      ],
      promotion: [],
      // 存储具体数据
      tableDate: []
    }
  },

  created() {
    this.getdata()
  },

  methods: {
    getdata() {
      querygwlist().then(res => {
        this.tableDate = res.data.base_info;
        console.log('企业信息-job：', res);
      })
    },
    // 查看岗位
    jobSelect(index, row) {
      // console.log('查看：',flowid)
      // 跳转页面的三种方式
      // 方式1：通过 path 跳转
      // this.$router.push({
      //   path: `/enterprises/EnEdit/:index`
      // });
      // 方式2：通过 name 跳转（推荐）
      // this.$router.push({
      //   name: 'enedit',
      //   params: { index: index }
      // });
      // 方式3：带查询参数（显示在URL中）
      this.$router.push({
        path: '/recruitManage/jobDetails',
        query: { joblist: row }
      });
    },
    // 下架
    unpublish(index,row) {
      updategwdown({
        "gwiflowid": row.gwi_flowid
      }).then(res => {
        console.log('下架')
        this.getdata()

      })

    },

    qyDelete(index, row) {

    }

  },
})
</script>



<style scoped>
.option-box {
  margin-top: 1%;

  span {
    margin-left: 1%;
  }

  .el-button {
    width: 5%;
  }
}

.el-table {
  margin-top: 1%;
}

.el-pagination {
  margin-top: 1%;
  float: right;
}
</style>
